package com.ishadows.notebook.model;
import android.graphics.Bitmap;

import com.activeandroid.Model;
import com.activeandroid.annotation.Column;
import com.activeandroid.annotation.Table;
import com.activeandroid.query.Select;
import com.app.library.utils.BitmapUtil;
@Table(name="transit_note_model")
public class TransitNoteModel extends Model{
	@Column(name="content")
	private byte [] content;
	@Column(name="img")
	private byte [] img;
	
	public void saveImg(Bitmap bitmap){
		Bitmap bp =Bitmap.createBitmap(bitmap);
		setImg(BitmapUtil.bitmapToByte(BitmapUtil.MinimizeBitmap(bp, 200),100));
	}

	public byte [] getImg() {
		return img;
	}

	public void setImg(byte [] img) {
		this.img = img;
	}

	public byte [] getContent() {
		return content;
	}

	public TransitNoteModel setContent(byte [] content) {
		this.content = content;
		return this;
	}
	
	public static TransitNoteModel getTransitNoteModel(){
		TransitNoteModel transitNoteModel =new Select().from(TransitNoteModel.class).executeSingle();
		if(transitNoteModel!=null){
			return transitNoteModel;
		}
		return new TransitNoteModel();
	}
}
